Aftershocks following the Kaikoura Earthquake November 14 2016

The ggmap and gganimate packages make this very easy. Install them both from Github as described in their READMEs, using devtools.

Without further ado:

library(readr)
library(ggplot2)
library(gganimate)
# library(animation)
library(lubridate)
library(ggmap)

NZ <- get_stamenmap(bbox = c(163.6084, -49.1817, 180, -32.28713), zoom = 6, 
    maptype = "toner-lite")
p <- ggmap(NZ)

eqnz <- read_csv("http://quakesearch.geonet.org.nz/csv?bbox=163.60840,-49.18170,182.98828,-32.28713&startdate=2016-11-13T11:00:00&enddate=2016-11-14T11:00:00")

theme_set(theme_bw())

# ignore warnings about frame, cumulative seems to be a bug using DateTime
# for frame so converting to numeric
p <- p + geom_point(data = eqnz, aes(x = longitude, y = latitude, color = magnitude, 
    size = magnitude, frame = as.numeric(origintime), cumulative = TRUE), alpha = 0.5) + 
    scale_color_continuous(low = "yellow", high = "red") + scale_size_continuous(guide = FALSE) + 
    labs(x = "longitude", y = "latitude", title = "Kaikoura Earthquake 2016 Aftershocks", 
        subtitle = "Earthquakes in the 24 hours after the main event on November 14")
gg_animate(p, ani.width = 800, ani.height = 800, interval = 0.4, "../../output/nz2016.gif")